package cn.lhl01.common;

import lombok.Getter;

/**
 * 接入层异常，包括参数检验异常、授权异常等。
 */
public class ApiException extends RuntimeException {
	@Getter
	private int code;

	public ApiException(ApiErrorEnum error) {
		super(error.getMessage());

		this.code = error.getCode();
	}

	public ApiException(ApiErrorEnum error, Throwable cause) {
		super(cause);

		this.code = error.getCode();
	}

	public ApiException(ApiErrorEnum error, String message) {
		super(message);

		this.code = error.getCode();
	}

	public ApiException(ApiErrorEnum error, String message, Throwable cause) {
		super(message, cause);

		this.code = error.getCode();
	}

}
